#include<iostream>
#include<iomanip>
using namespace std;
//char s[1000];
int main()
{
	int n,a[25][25];
	cin >> n;
	for (int i=0;i<n;i++)
		for (int j=0;j<n;j++)
			cin >> a[i][j];
			
	for (int i=0;i<n;i++)
	{
		a[i][i] +=10;
	}
	for (int i=0;i<n;i++)
	{
		a[i][n-i-1] +=10; 
	}		
			
	for (int i=0;i<n;i++)
	{
		for (int j=0;j<n;j++)
		{			
			cout << setw(5) << a[i][j] ;
		}
		cout << endl;
	}
	return 0;
}



